<template>
	<view class="tab">
		<view class="tab-item" :class="{ active: active == i }" v-for="(tab, i) in tabs" :key="i" @click="tabClick(tab, i)">{{ tab.title }}</view>
	</view>
</template>

<script>
export default {
	props: {
		tabs: {
			type: Array,
			value: []
		},
		active: {
			type: Number,
			default: () => 0
		}
	},
	methods: {
		tabClick(tab, i) {
			tab.index = i;
			this.$emit('tabClick', tab);
		}
	},
	mounted() {}
};
</script>

<style lang="less" scoped>
@import 'index';
</style>
